package org.cliff.message.platform.core.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * URI处理工具类
 * @author 刘文
 * @date 2023/10/20
 */
public final class UriUtils {
    /**
     * URL匹配模式
     */
    private static final Pattern URL_PATTERN = Pattern.compile("(https?\\:\\/\\/)?([^\\/]*)([^\\?]*)\\??.*",Pattern.CASE_INSENSITIVE);

    public static String getUriPathFromUrl(String url) {
        Matcher matcher = URL_PATTERN.matcher(url);
        if (matcher.matches()) {
            return matcher.group(3);
        }
        return "";
    }
}
